<template>
	<div style="background-color: #F2F2F2;width: 100%;height: 100%">
		<!-- 专家库 -->
		<div>
			<van-field :value="expert_name" center clearable placeholder="专家搜索" :use-button-slot="true"
				left-icon="search" :border="false" @input="change1">
				<van-button slot="button" size="small" type="info" custom-class="button" @click="search_expert()">
					搜索
				</van-button>
			</van-field>
		</div>
		<div style="padding-top: 5%;">
			<div v-for="(item, index) in expertMessage" :key="index"
				style="position:relative;width: 95%;margin: auto auto 2% auto;" @click="getExpertDetail(item)">
				<div style="position: absolute;width: 80%;right: -63%;">
					<img v-if="item.flag === '0'" src="https://czsc.oss-cn-beijing.aliyuncs.com/qdimgs/jiao1.png"
						style="width: 20%;height: 10vh;" />
					<img v-if="item.flag === '1'" src="https://czsc.oss-cn-beijing.aliyuncs.com/qdimgs/jiao2.png"
						style="width: 20%;height: 10vh;" />
					<img v-if="item.flag === '2'" src="https://czsc.oss-cn-beijing.aliyuncs.com/qdimgs/jiao3.png"
						style="width: 20%;height: 10vh;" />
					<img v-if="item.flag === '3'" src="https://czsc.oss-cn-beijing.aliyuncs.com/qdimgs/jiao4.png"
						style="width: 20%;height: 10vh;" />
				</div>
				<div style="background-color: #FFFFFF;display: flex;">
					<div style="width: 30%;">
						<image :src="item.imageUrl" style="width: 100%;height: 20vh;"></image>
					</div>
					<div style="margin-left: 10%;margin-top: 2%;width: 50%;">
						<div style="margin-bottom: 3%;">
							姓名：{{item.expertName}}
						</div>
						<div style="margin-bottom: 3%;">
							专业：{{item.expertProfession}}
						</div>
						<div style="margin-bottom: 3%;">
							学位/学历：{{item.degreeEducation}}
						</div>
						<div style="margin-bottom: 3%;">
							职务：{{item.post}}
						</div>
					</div>
				</div>
				
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				expertMessage: [],
				expert_name: ''
			}
		},
		created() {
			this.getExpertMessage();
		},
		methods: {
			change1(event) {
				this.expert_name = event.detail;
			},
			getExpertMessage() {
				uni.request({
					method: 'GET',
					url: 'https://www.gjegm.ltd/czsczq/expertMessage/getExpertMessageAll',
					data: {

					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'token': uni.getStorageSync('token')
					},
					success: (res) => {
						this.expertMessage = res.data.obj;

					}
				});
			},
			getExpertDetail(item){
				uni.navigateTo({
					url: '/pages/expert/expert_detail?id=' + item.id
				});
			},
			search_expert(){
				uni.request({
					method: 'POST',
					url: 'https://www.gjegm.ltd/czsczq/expertMessage/getExpertByIdAndName',
					data: {
						name: this.expert_name
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'token': uni.getStorageSync('token')
					},
					success: (res) => {
						this.expertMessage = res.data.obj;
				
					}
				});
			}
		}
	}
</script>

<style>
</style>
